using System;
using System.Collections.Generic;
using System.Text;
using interfaces;

namespace retrofit
{
    /// <summary>
    /// data model energy efficiency measure class
    /// contain instance definition for each energy efficiency measure
    /// </summary>
    public class DmMeasure
    {
		public static string MeasureGroupTableName = "measuregroup";

		public enum measure_group_t
		{
			ID_MGT,
			Code_MGT,
			MeasureGroup_MGT,
			MeasureGroupCN_MGT,
			NUM_MGT
		};

		public static string[] MeasureGroupTableHeaders = new string[] 
        {
			"ID",
            "Code",
			"MeasureGroup",
			"MeasureGroup_CN"
        };


		public static string MeasureTableName = "measures";

		public enum measure_param_t
		{
			ID_MPT,
			SubMeasureCode_MPT,
			MeasureText_MPT,
			BuildingType_MPT,
			MeasureType_MPT,
			OptionType_MPT,
			InfluenceCategory_MPT,
			ResultTable_MPT,
			PreProcess_MPT,
			LowNoCost_MPT,
			Control_MPT,
			Options_MPT,
			Effects_MPT,
			CostType_MPT,
			AppliedArea_MPT,
			InitialCost_MPT,
			MaterialCost_MPT,
			LaborHour_MPT,
			OMCost_MPT,
//			CostSlope_MPT,
			Description_MPT,
			DescriptionCN_MPT,
			MeasureTextCN_MPT,
			OptionsCN_MPT,
			NUM_MPT
		};

		public static string[] MeasureTableHeaders = new string[] 
        {
			"ID",
            "SubmeasureCode",
			"MeasureText",
			"BuildingType",
			"MeasureType",
			"OptionType",
			"InfluenceCategory",
			"ResultTable",
			"Preprocess",
			"LowCost",
			"Control",
			"Options",
			"Effects",
			"CostType",
			"AppliedArea",
			"InitialCost",
			"MaterialCost",
			"LaborHour",
			"OMCost",
//			"CostSlope",
			"Description",
			"DescriptionCN",
			"MeasureTextCN",
			"OptionsCN"
        };

		/// <summary>
        /// measure option type
        /// </summary>
		public enum measure_t
		{
			Simulate_MOT,
			Empirical_MOT,
			NUM_MOT
		};

		public static string[] MeasureType = new string[] 
        {
            "simulate",
			"empirical"
        };

		public enum input_option_t
		{
			Continuous_IOT,
			List_IOT,
			NUM_IOT
		};

		public static string[] InputOptionType = new string[] { 
            "continuous", "list"
        };


        //** ---------------- project data -------------- **//

		public int							dm_id;					/// measure ID
//        public string						dm_name;                /// measure keyword name.
//        public Keyword.keyword_t			dm_type;                /// measure keyword specified by Keyword.keyword_t.
//        public interf.BEE_Input_T			dm_inputType;           /// input variable type.
//        public int							dm_numInput;            /// number of instance input for current measure.
//        public int							dm_selectedInputNum;    /// the selected input number.

//        public string[]						dm_input;               /// the instance input array for current measure.
//        public int[]						dm_selectedInput;       /// the selected inputs index.


		public string						dm_code;				/// sub-measure code. (6 digit measure code)
		public string						dm_text;				/// sub-measure text.
		public List<string>					dm_buildingType;		/// building type. compare with interf.BEE_Building_T																	
		public string						dm_measureType;			/// measure option type. compare with measure_opt_t
		public string						dm_optionType;			/// input option type. compare with interf.BEE_Option_T
		public List<string>					dm_influEnergy;			/// influence energy categories, compare with Keyword.energy_cat_t
		public string						dm_resultTable;			/// the result table type. compare with Keyword.table_t

		public List<string>					dm_options;				/// measure's options
		public List<string>					dm_effects;				/// measure's effect (influence factor)
		public string						dm_description;			/// measure description
		public string						dm_descriptionCN;		/// measure description
		public string						dm_textCN;				/// measure Chinese text
		public List<string>					dm_optionsCN;			/// measure Chinese option

		public int							dm_control;				/// control measure indicator, 1 for true, 0 for false
		public int							dm_lowCost;				/// low/no cost measure indicator, 1 for true, 0 for false


        //** ------------------ cost data ----------------- **//

		public string						dm_costType;			/// cost type.
		public string						dm_appliedArea;			/// cost and energy applied area.
		public string						dm_initiCost;			/// initial cost.
		public List<string>					dm_materialCost;		/// cost list to maintain the same dimension as measure option
		public string						dm_laborHour;			/// labor hour for measure installation
		public string						dm_omCost;				/// yearly O&M cost
//		public string						dm_costSlope;			/// cost slope used to calculated continuous variable cost.
																	
//        public int[]					dm_longevity;           /// instance life time in [year].
//        public int[]					dm_usedYear;            /// instance default used year at retrofit time [year]
//        public double[]					dm_equipCost;           /// equipment investment cost in [RMB]
//        public double					dm_laborCost;           /// labor cost in [labor*hr]

//        public double					dm_discount;            /// discount rate for premature replacement.

		/// <summary>
		/// construction for Measure class.
		/// pass in the measure keyword index and it initialize all its data member variables
		/// </summary>
		/// <param name="kw">the input keyword index, accessed from Keyword.keyword_t kw </param>
		public DmMeasure(Keyword.keyword_t kw)
		{
//			dm_name = Keyword.m_keyword[(int)kw];	// measure name
//			dm_type = kw;							// keyword type
//			dm_inputType = interf.BEE_enumMeasureInputType[(int)kw];		// input variable type
//			dm_numInput = Keyword.m_inputs_num[(int)kw];					// total input number
//			dm_selectedInputNum = Keyword.m_inputs_selected_num[(int)kw];	// selected input number
//			dm_input = Keyword.m_inputs[(int)kw];
//			dm_selectedInput = Keyword.m_inputs_selected[(int)kw];

			// TODO
			// dm_longevity;						// instance life time in [year].
//			dm_usedYear = dm_longevity;				// in default, we assume the equipment is fully used for its entire life
			// TODO
            // dm_equipCost;						// equipment clost
//			dm_laborCost = 1000;					// 1000 labor hours

//			dm_discount = 0.05;						// in default, discount rate is 5%,
		}

		public DmMeasure()
		{
		}

    }
}
